"""
 生成一副扑克牌，进行洗牌和发牌工作
"""
import random

flower = ['♥','♠','♣','♦']
nums = ['2','3','4','5','6','7','8','9','10','J','Q','K','A']

# 1. 生成扑克牌
poker = [ f + num for f in flower for num in nums] + ['大王','小王']
print(poker)

# 2. 原生的洗牌方式
shuffle_poker = [] # 用于存储洗牌后的扑克
for i in range(len(poker)):
    index = random.randint(0,len(poker)-1)
    shuffle_poker.append(poker.pop(index))

# shuffle_poker = poker.copy()
# random.shuffle(shuffle_poker)
print(f'洗牌后：{shuffle_poker}')

# 发牌 玩家17张
player1 = []
player2 = []
player3 = []
bottom = [] # 底牌 3 张

for i in range(17):
    player1.append(shuffle_poker.pop())
    player2.append(shuffle_poker.pop())
    player3.append(shuffle_poker.pop())
# 剩了三张底牌
bottom = shuffle_poker[:3]


print(f'玩家一：{player1}')
print(f'玩家二:{player2}')
print(f'玩家三:{player3}')
print(f'底牌：{bottom}')
